#include <chrono>
#include <iostream>
#include <thread>
void pause_thread(int n) {
  std::cout << "Thread id : " << std::this_thread::get_id() << " Thread Pause "
            << n << " second\n";
  std::this_thread::sleep_for(std::chrono::seconds(n));
  std::cout << "Exit....\n";
}
int main() {
  std::thread t1 = std::thread(pause_thread, 2);
  std::thread t2 = std::thread(pause_thread, 2);
  std::cout << "Detach thread1\n";
  t1.detach();
  std::cout << "Detach thread2\n";
  t2.detach();
  std::this_thread::sleep_for(std::chrono::seconds(4));
}
